﻿#ifndef __TEST__POOL__ALLOC__H
#define __TEST__POOL__ALLOC__H

#include <list>
#include "CPoolAlloc.h"

struct TestObj
{
	TestObj()
	{
		memset(this, 0, sizeof(TestObj));
	}
	void setValue(size_t data)
	{
		data_1 = data;
		data_2 = data;
		data_3 = data;
		data_4 = data;
		data_5 = data;
		data_6 = data;
		data_7 = data;
		data_8 = data;
		data_9 = data;
		data_10 = data;
		data_11 = data;
		data_12 = data;
		data_13 = data;
		data_14 = data;
		data_15 = data;
		data_16 = data;
		data_17 = data;
		data_18 = data;
		data_19 = data;
		data_20 = data;
	}

	long long data_1;
	long long data_2;
	long long data_3;
	long long data_4;
	long long data_5;
	long long data_6;
	long long data_7;
	long long data_8;
	long long data_9;
	long long data_10;
	long long data_11;
	long long data_12;
	long long data_13;
	long long data_14;
	long long data_15;
	long long data_16;
	long long data_17;
	long long data_18;
	long long data_19;
	long long data_20;
};

typedef std::list<TestObj, CPoolAlloc<TestObj> > ListPoolBig;
typedef std::list<TestObj> ListBig;

typedef std::list<unsigned int, CPoolAlloc<unsigned int> > ListPool;
typedef std::list<unsigned int> List;

class CTestPoolAlloc
{
public:
	enum
	{
		__TYPE_RAND = 0,
		__TYPE_EVERY,
	};

public:
	CTestPoolAlloc()
	{}
	~CTestPoolAlloc()
	{
		this->lst.clear();
	}
public:
	void Push(unsigned int val);
	void Pop();
	void ViolenceTest(size_t num, int rate = 50);

private:
	ListPool lst;
	ListPoolBig lstBig;
};

#endif	/// __TEST__POOL__ALLOC__H